package org.example.api.pc;

import org.example.R.R;
import org.example.entity.dto.AddAssQuestionDto;
import org.example.entity.dto.QueryQuestionDto;
import org.example.service.pc.AssQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author sunyaoyao
 * @Date 2024/7/28 17:10
 */
@RestController
@RequestMapping("/api/pc/question")
public class PCAssQuestionController {

    @Autowired
    private AssQuestionService assQuestionService;

    @PostMapping("/add")
    public R addQuestion(@RequestBody AddAssQuestionDto dto){
        return assQuestionService.add(dto);
    }

    @PostMapping("/list")
    public R list(){
        return assQuestionService.list();
    }

    @PostMapping("/list_role")
    public R listByRole(@RequestBody QueryQuestionDto dto){
        return assQuestionService.lisByRole(dto);
    }

    @PostMapping("/delete")
    public R delete(@RequestParam("id") Long id){
        return assQuestionService.delete(id);
    }

    @PostMapping("/over_task")
    public R overTask(@RequestParam("id") Long id){
        return assQuestionService.overTask(id);
    }

}
